﻿using DeviceDebugger.Model.Enums;
using GalaSoft.MvvmLight;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DeviceDebugger.Model
{
    /// <summary>
    /// 与PLC通讯协议
    /// </summary>
    public class ProtocolModel : ObservableObject
    {
        private Int64 _Id;
        private string _name;
        private DataTypeEnum _dataType;
        private string _PLC_Adress;
        private string _OPC_Adress;
        private string _description;
        private ProtocolType _protocolType;
        private bool _isDisplay;
        public bool IsDisplay
        {
            get { return _isDisplay; }
            set { _isDisplay = value; RaisePropertyChanged(() => IsDisplay); }
        }


        private object _value;

        /// <summary>
        /// 点值
        /// </summary>
        public object Value
        {
            get { return _value; }
            set { _value = value; RaisePropertyChanged(() => Value); }
        }

        /// <summary>
        /// 点类型，1：读取，2：写入
        /// </summary>
        public ProtocolType ProtocolType
        {
            get { return _protocolType; }
            set { _protocolType = value; RaisePropertyChanged(() => ProtocolType); }
        }

        /// <summary>
        /// 描述
        /// </summary>
        public string Description
        {
            get { return _description; }
            set { _description = value; RaisePropertyChanged(() => Description); }
        }
        /// <summary>
        /// PLC中的数据类型
        /// </summary>
        public DataTypeEnum DataType
        {
            get { return _dataType; }
            set { _dataType = value; RaisePropertyChanged(() => DataType); }
        }

        /// <summary>
        /// OPC读取地址
        /// </summary>
        public string OPC_Adress
        {
            get { return _OPC_Adress; }
            set { _OPC_Adress = value; RaisePropertyChanged(() => OPC_Adress); }
        }

        /// <summary>
        /// PLC地址
        /// </summary>
        public string PLC_Adress
        {
            get { return _PLC_Adress; }
            set { _PLC_Adress = value; RaisePropertyChanged(() => PLC_Adress); }
        }

        /// <summary>
        /// 信息名称
        /// </summary>
        public string Name
        {
            get { return _name; }
            set { _name = value; RaisePropertyChanged(() => Name); }
        }

        /// <summary>
        /// ID
        /// </summary>
        public Int64 Id
        {
            get { return _Id; }
            set { _Id = value; RaisePropertyChanged(() => Id); }
        }

    }
}
